import numpy as np
import matplotlib.pyplot as plt

xparams = [
    [5000, 7500, 0, 1500, 100],
    [3000, 3000, 100, 1500, 50],
    [9000, 2900, 50, 1000, 30]
]


def __init_data():
    x1x2y_all = None
    for k, v in enumerate(xparams):
        cls_id = k + 1
        xcenter = v[0]  # scalar: center x of this class
        ycenter = v[1]  # scalar: center y of this class
        delta_loc = v[2]
        delta_scale = v[3]
        size = v[4]
        x1 = np.tile(np.float64(xcenter), [size, 1])
        xdelta = np.random.normal(delta_loc, delta_scale, size).reshape(size, 1)
        x1 += xdelta
        x2 = np.tile(np.float64(ycenter), [size, 1])
        ydelta = np.random.normal(delta_loc, delta_scale, size).reshape(size, 1)
        x2 += ydelta
        y = np.tile(cls_id, [size, 1])
        x1x2y = np.c_[x1, x2, y]
        if x1x2y_all is None:
            x1x2y_all = x1x2y
        else:
            x1x2y_all = np.r_[x1x2y_all, x1x2y]
    # print(x1x2y_all[:5])
    # print(x1x2y_all[95:105])
    # print(x1x2y_all[145:155])
    # print(x1x2y_all[-5:])
    np.random.shuffle(x1x2y_all)
    return x1x2y_all


x1x2y = __init_data()
